{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-07-12T13:43:37.465934Z",
     "start_time": "2018-07-12T13:43:36.602969Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from glob import glob\n",
    "from IPython.display import display\n",
    "pd.set_option('display.max_columns', 99)\n",
    "pd.set_option('display.max_rows', 99)\n",
    "from matplotlib import pyplot as plt\n",
    "import EDA\n",
    "import utils\n",
    "#sorted(glob('../data/*'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-07-12T13:44:05.241595Z",
     "start_time": "2018-07-12T13:43:41.963268Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 20/20 [00:06<00:00,  3.00it/s]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SK_ID_BUREAU</th>\n",
       "      <th>MONTHS_BALANCE</th>\n",
       "      <th>STATUS</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>26079753</th>\n",
       "      <td>5001709</td>\n",
       "      <td>0</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26079754</th>\n",
       "      <td>5001709</td>\n",
       "      <td>-1</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26079755</th>\n",
       "      <td>5001709</td>\n",
       "      <td>-2</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26079756</th>\n",
       "      <td>5001709</td>\n",
       "      <td>-3</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26079757</th>\n",
       "      <td>5001709</td>\n",
       "      <td>-4</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          SK_ID_BUREAU  MONTHS_BALANCE STATUS\n",
       "26079753       5001709               0      C\n",
       "26079754       5001709              -1      C\n",
       "26079755       5001709              -2      C\n",
       "26079756       5001709              -3      C\n",
       "26079757       5001709              -4      C"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = utils.read_pickles('../data/bureau_balance').sort_values(['SK_ID_BUREAU', 'MONTHS_BALANCE'], ascending=[True, False])\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-07-12T13:44:22.061822Z",
     "start_time": "2018-07-12T13:44:05.243182Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Shape: (27299925, 3)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>DataType</th>\n",
       "      <th>#Nulls</th>\n",
       "      <th>#Uniques</th>\n",
       "      <th>Min</th>\n",
       "      <th>Mean</th>\n",
       "      <th>Max</th>\n",
       "      <th>Std</th>\n",
       "      <th>top10 val</th>\n",
       "      <th>top10 cnt</th>\n",
       "      <th>top10 raito</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>SK_ID_BUREAU</th>\n",
       "      <td>int64</td>\n",
       "      <td>0</td>\n",
       "      <td>817395</td>\n",
       "      <td>5001709.0</td>\n",
       "      <td>6.036297e+06</td>\n",
       "      <td>6842888.0</td>\n",
       "      <td>492348.856904</td>\n",
       "      <td>[6104966, 5760763, 5568354, 6365230, 6635521, ...</td>\n",
       "      <td>[97, 97, 97, 97, 97, 97, 97, 97, 97, 97]</td>\n",
       "      <td>[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MONTHS_BALANCE</th>\n",
       "      <td>int64</td>\n",
       "      <td>0</td>\n",
       "      <td>97</td>\n",
       "      <td>-96.0</td>\n",
       "      <td>-3.074169e+01</td>\n",
       "      <td>0.0</td>\n",
       "      <td>23.864509</td>\n",
       "      <td>[-1, -2, -3, 0, -4, -5, -6, -7, -8, -9]</td>\n",
       "      <td>[622601, 619243, 615080, 610965, 609138, 60266...</td>\n",
       "      <td>[0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.0...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>STATUS</th>\n",
       "      <td>object</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>['C', '0', 'X', '1', '5', '2', '3', '4']</td>\n",
       "      <td>[13646993, 7499507, 5810482, 242347, 62406, 23...</td>\n",
       "      <td>[0.5, 0.27, 0.21, 0.01, 0.0, 0.0, 0.0, 0.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               DataType  #Nulls  #Uniques        Min          Mean        Max  \\\n",
       "SK_ID_BUREAU      int64       0    817395  5001709.0  6.036297e+06  6842888.0   \n",
       "MONTHS_BALANCE    int64       0        97      -96.0 -3.074169e+01        0.0   \n",
       "STATUS           object       0         8        NaN           NaN        NaN   \n",
       "\n",
       "                          Std  \\\n",
       "SK_ID_BUREAU    492348.856904   \n",
       "MONTHS_BALANCE      23.864509   \n",
       "STATUS                    NaN   \n",
       "\n",
       "                                                        top10 val  \\\n",
       "SK_ID_BUREAU    [6104966, 5760763, 5568354, 6365230, 6635521, ...   \n",
       "MONTHS_BALANCE            [-1, -2, -3, 0, -4, -5, -6, -7, -8, -9]   \n",
       "STATUS                   ['C', '0', 'X', '1', '5', '2', '3', '4']   \n",
       "\n",
       "                                                        top10 cnt  \\\n",
       "SK_ID_BUREAU             [97, 97, 97, 97, 97, 97, 97, 97, 97, 97]   \n",
       "MONTHS_BALANCE  [622601, 619243, 615080, 610965, 609138, 60266...   \n",
       "STATUS          [13646993, 7499507, 5810482, 242347, 62406, 23...   \n",
       "\n",
       "                                                      top10 raito  \n",
       "SK_ID_BUREAU    [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...  \n",
       "MONTHS_BALANCE  [0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.0...  \n",
       "STATUS                [0.5, 0.27, 0.21, 0.01, 0.0, 0.0, 0.0, 0.0]  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "EDA.df_info(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2018-07-12T13:44:25.773877Z",
     "start_time": "2018-07-12T13:44:23.328294Z"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZMAAAD8CAYAAACyyUlaAAAABHNCSVQICAgIfAhkiAAAAAlwSF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+vNsQ4fJAuZ7FMtGfkTL+4A/TPI08F+AD7T6Ru7znF8B/kWS+5L8nyS/0eqT0HeS/Dbw7ar6+iGrJqL/Q97DYCQGk9H3Ne3jup4aDJDkL4FfHLHq96vqjvk2G1ErRofrupnuttDXAjgX+PdV9dkkvwPcBPwW838t1pVF+n40cCKDSzm/Adye5JfYIH2HRfv/QQaXe1612Yjauuv/Un4GJPl94CDwqbnNRrRfd31fxJr2cd2HSVX91go2W+hRLAs+ouVIttDXIsmtwHvb2/8F/I+2vOhjadaDRfp+JfC5GlxI/kqSnzB4VtGG6DvM3/8kWxjcE/h6Ehj08WttAsaG6P9iPwOS7AD+FXBu+x6ADdL3RaxpHyf1Mtde4JIkxyY5A9gMfIWN/YiWZ4B/2ZbfBjzRlvcCl7WZPecAL1XVs+M4wVX05wz6TJJfYXAz8jvM/32wYVTVw1V1clVtqqpNDH7AvKmq/h8T8Nkn2Qa8H/jtqnp5aNWG/+xZ459n635kspAk7wD+K/B64AtJHqyq86vq0SS3A99gMPS9qqp+3LbZqI9o+bfAx5McDfyAnz5NeR+DWT2zwMvAu8dzeqtqD7AnySPAj4Ad7f9Q5/0+mBCT8Nn/NwYztu5uI7N7q+rfLfQzYKOoNX7klL8BL0nqNqmXuSRJh5FhIknqZphIkroZJpKkboaJJKmbYSJJ6maYSJK6GSaSpG7/H9OByG583uoAAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f8f35113ef0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df.MONTHS_BALANCE.hist(bins=30); plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "ids = df.SK_ID_BUREAU.unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>SK_ID_BUREAU</th>\n",
       "      <th>MONTHS_BALANCE</th>\n",
       "      <th>STATUS</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1404803</th>\n",
       "      <td>5229582</td>\n",
       "      <td>0</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404804</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-1</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404805</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-2</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404806</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-3</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404807</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404808</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404809</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-6</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404810</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404811</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-8</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404812</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-9</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404813</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-10</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404814</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-11</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404815</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404816</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-13</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404817</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-14</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404818</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-15</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404819</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-16</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404820</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-17</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404821</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-18</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404822</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-19</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404823</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-20</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404824</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-21</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404825</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-22</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404826</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-23</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404827</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-24</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404828</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-25</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404829</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-26</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404830</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-27</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404831</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-28</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404832</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-29</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1404833</th>\n",
       "      <td>5229582</td>\n",
       "      <td>-30</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750852</th>\n",
       "      <td>5819222</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750853</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750854</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750855</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750856</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750857</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750858</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750859</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750860</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-8</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750861</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750862</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-10</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13750863</th>\n",
       "      <td>5819222</td>\n",
       "      <td>-11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710643</th>\n",
       "      <td>5837388</td>\n",
       "      <td>0</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710644</th>\n",
       "      <td>5837388</td>\n",
       "      <td>-1</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710645</th>\n",
       "      <td>5837388</td>\n",
       "      <td>-2</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710646</th>\n",
       "      <td>5837388</td>\n",
       "      <td>-3</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710647</th>\n",
       "      <td>5837388</td>\n",
       "      <td>-4</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2710648</th>\n",
       "      <td>5837388</td>\n",
       "      <td>-5</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648303</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-42</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648304</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-43</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648305</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-44</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648306</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-45</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648307</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-46</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648308</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-47</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648309</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-48</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648310</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-49</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648311</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-50</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648312</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-51</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9648313</th>\n",
       "      <td>6406648</td>\n",
       "      <td>-52</td>\n",
       "      <td>X</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322954</th>\n",
       "      <td>6732009</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322955</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322956</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322957</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322958</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322959</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322960</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322961</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322962</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-8</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24322963</th>\n",
       "      <td>6732009</td>\n",
       "      <td>-9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489833</th>\n",
       "      <td>6765503</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489834</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489835</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489836</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489837</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489838</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489839</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489840</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489841</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-8</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489842</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489843</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-10</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489844</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489845</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489846</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-13</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489847</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-14</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489848</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-15</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489849</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489850</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-17</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489851</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-18</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489852</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-19</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489853</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-20</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489854</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-21</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489855</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-22</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489856</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-23</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489857</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-24</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489858</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-25</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489859</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-26</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14489860</th>\n",
       "      <td>6765503</td>\n",
       "      <td>-27</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>214 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          SK_ID_BUREAU  MONTHS_BALANCE STATUS\n",
       "1404803        5229582               0      X\n",
       "1404804        5229582              -1      X\n",
       "1404805        5229582              -2      X\n",
       "1404806        5229582              -3      X\n",
       "1404807        5229582              -4      0\n",
       "1404808        5229582              -5      0\n",
       "1404809        5229582              -6      X\n",
       "1404810        5229582              -7      0\n",
       "1404811        5229582              -8      0\n",
       "1404812        5229582              -9      X\n",
       "1404813        5229582             -10      0\n",
       "1404814        5229582             -11      X\n",
       "1404815        5229582             -12      0\n",
       "1404816        5229582             -13      0\n",
       "1404817        5229582             -14      X\n",
       "1404818        5229582             -15      0\n",
       "1404819        5229582             -16      X\n",
       "1404820        5229582             -17      X\n",
       "1404821        5229582             -18      0\n",
       "1404822        5229582             -19      0\n",
       "1404823        5229582             -20      0\n",
       "1404824        5229582             -21      X\n",
       "1404825        5229582             -22      0\n",
       "1404826        5229582             -23      0\n",
       "1404827        5229582             -24      0\n",
       "1404828        5229582             -25      X\n",
       "1404829        5229582             -26      X\n",
       "1404830        5229582             -27      X\n",
       "1404831        5229582             -28      X\n",
       "1404832        5229582             -29      X\n",
       "1404833        5229582             -30      X\n",
       "13750852       5819222               0      0\n",
       "13750853       5819222              -1      0\n",
       "13750854       5819222              -2      0\n",
       "13750855       5819222              -3      0\n",
       "13750856       5819222              -4      0\n",
       "13750857       5819222              -5      0\n",
       "13750858       5819222              -6      0\n",
       "13750859       5819222              -7      0\n",
       "13750860       5819222              -8      0\n",
       "13750861       5819222              -9      0\n",
       "13750862       5819222             -10      0\n",
       "13750863       5819222             -11      0\n",
       "2710643        5837388               0      C\n",
       "2710644        5837388              -1      C\n",
       "2710645        5837388              -2      C\n",
       "2710646        5837388              -3      C\n",
       "2710647        5837388              -4      C\n",
       "2710648        5837388              -5      C\n",
       "...                ...             ...    ...\n",
       "9648303        6406648             -42      0\n",
       "9648304        6406648             -43      0\n",
       "9648305        6406648             -44      0\n",
       "9648306        6406648             -45      0\n",
       "9648307        6406648             -46      0\n",
       "9648308        6406648             -47      0\n",
       "9648309        6406648             -48      0\n",
       "9648310        6406648             -49      0\n",
       "9648311        6406648             -50      0\n",
       "9648312        6406648             -51      0\n",
       "9648313        6406648             -52      X\n",
       "24322954       6732009               0      0\n",
       "24322955       6732009              -1      0\n",
       "24322956       6732009              -2      0\n",
       "24322957       6732009              -3      0\n",
       "24322958       6732009              -4      0\n",
       "24322959       6732009              -5      0\n",
       "24322960       6732009              -6      0\n",
       "24322961       6732009              -7      0\n",
       "24322962       6732009              -8      0\n",
       "24322963       6732009              -9      0\n",
       "14489833       6765503               0      0\n",
       "14489834       6765503              -1      0\n",
       "14489835       6765503              -2      0\n",
       "14489836       6765503              -3      0\n",
       "14489837       6765503              -4      0\n",
       "14489838       6765503              -5      0\n",
       "14489839       6765503              -6      0\n",
       "14489840       6765503              -7      0\n",
       "14489841       6765503              -8      0\n",
       "14489842       6765503              -9      0\n",
       "14489843       6765503             -10      0\n",
       "14489844       6765503             -11      0\n",
       "14489845       6765503             -12      0\n",
       "14489846       6765503             -13      0\n",
       "14489847       6765503             -14      0\n",
       "14489848       6765503             -15      0\n",
       "14489849       6765503             -16      0\n",
       "14489850       6765503             -17      0\n",
       "14489851       6765503             -18      0\n",
       "14489852       6765503             -19      0\n",
       "14489853       6765503             -20      0\n",
       "14489854       6765503             -21      0\n",
       "14489855       6765503             -22      0\n",
       "14489856       6765503             -23      0\n",
       "14489857       6765503             -24      0\n",
       "14489858       6765503             -25      0\n",
       "14489859       6765503             -26      0\n",
       "14489860       6765503             -27      0\n",
       "\n",
       "[214 rows x 3 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tmp = df[df.SK_ID_BUREAU.isin(np.random.choice(ids, size=9))]\n",
    "tmp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "tmp.to_csv('sample_bb.csv', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
